import { RouterTypes } from '@ant-design/pro-layout/lib/typings';

export const independentRoutes = [
    {
        path: '/login',
        name: '登录页面',
        component: './Login',
    },
].map((item) => ({ ...item, hideInMenu: true }));

const routes: Exclude<RouterTypes<any>['route'], undefined>[] = [
    { path: '/', name: '首页 ', component: './statistics' },
    {
        path: '/personnelEntry',
        name: '人员录入',
        component: './personnelEntry',
        title: '人员录入',
    },
    {
        path: '/personnelEntry',
        name: '人员录入',
        hideInMenu: true,
        flatMenu: true,
        routes: [
            {
                path: '/personnelEntry/details/:id',
                name: '人员详情',
                component: './personnelEntry/details',
            },
            {
                path: '/personnelEntry/addPerson',
                name: '新增人员录入',
                component: './personnelEntry/components/AddPerson',
            },
            {
                path: '/personnelEntry/modifyPerson',
                name: '编辑人员录入',
                component: './personnelEntry/components/ModifyPerson',
            },
        ],
    },
    {
        path: '/enrollBook',
        name: '录入书籍',
        component: './enrollBook',
    },
    {
        path: '/enrollBook',
        name: '录入书籍',
        hideInMenu: true,
        flatMenu: true,
        routes: [
            {
                path: '/enrollBook/details/:id',
                name: '录入书籍详情',
                component: './enrollBook/details',
            },
            {
                path: '/enrollBook/addBook',
                name: '新增录入书籍',
                component: './enrollBook/addBook',
            },
            {
                path: '/enrollBook/editBook/:id',
                name: '编辑录入书籍',
                component: './enrollBook/editBook',
            },
        ],
    },
    {
        path: '/borrowBook',
        name: '租赁书籍',
        component: './borrowBook',
    },
    {
        path: '/borrowBook',
        name: '租赁书籍',
        hideInMenu: true,
        flatMenu: true,
        routes: [
            {
                path: '/borrowBook/details/:id',
                name: '租赁书籍详情',
                component: './borrowBook/details',
            },
        ],
    },
    {
        path: '/returnBook',
        name: '归还书籍',
        component: './returnBook',
    },
    {
        path: '/returnBook',
        name: '归还书籍',
        hideInMenu: true,
        flatMenu: true,
        routes: [
            {
                path: '/returnBook/details/:id',
                name: '归还书籍详情',
                component: './returnBook/details',
            },
        ],
    },
    {
        path: '/inventory',
        name: '库存数量',
        component: './inventory',
        // routes: [
        //     {
        //         path: '/inventory/name',
        //         name: '234',
        //         component: './inventory',
        //     },
        // ],
    },
    // { path: '/statistics', name: '数据统计', component: './statistics' },
    { path: '/extension', name: '推广书籍', component: './extension' },
    {
        path: '/personalCenter/:id',
        name: '个人中心',
        component: './PersonalCenter',
        hideInMenu: true,
    },
    ...independentRoutes,
];

export default routes;
